package dome2;

import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description: Comparator接口代码测试
 * User: 王圆豪
 * Date: 2024-06-06
 * Time: 21:02
 */
public class Test {
    public static void main(String[] args) {
        Student student1 = new Student("小明", 15);
        Student student2 = new Student("大宏", 16);
        Student[] students = new Student[]{student1,student2};
        Students students1 = new Students(students);
        System.out.println("排序前：" + students1);

        CompareByName compareByName = new CompareByName();
        Arrays.sort(students1.students, compareByName);

        System.out.println("排序后：" + students1);
    }
}
